<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>签到成功动画</title>
    <style>
      div {
        position: relative;
        width: 300px;
        height: 300px;
        margin: 0 auto;
        /* background-color: #75c1f8; */
      }
      .spantr {
        position: absolute;
        top: 50%;
        left: 23%;
        transform: translateY(-50%);
        width: 10px;
        height: 120px;
        border-radius: 10px;
        background-color: #fff;
        z-index: 2;
        transition: all 1s;
      }
      .box::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 23%;
        transform: translateY(-50%);

        border-radius: 10px;
        width: 170px;
        height: 120px;

        background-color: #4da7e9;
        z-index: 1;
      }
      img {
        position: absolute;
        width: 100%;
        z-index: 3;
      }
      .spantr:hover {
        width: 170px;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <span class="spantr"></span>
      <img src="./assets/Frame 1321316300.png" alt="" />
    </div>
    <button>点击开始动画</button>
    <script>
      let spantT = document.querySelector(".spantr");
      let btn = document.querySelector("button");
      btn.addEventListener("click", () => {
        spantT.style.width = "170px";
        setTimeout(() => {
          spantT.style.width = "10px";
        }, 3000);
      });
    </script>
  </body>
</html>
